package com.atguigu.gmall.client.service;

import com.atguigu.gmall.entity.*;
import com.atguigu.gmall.result.RetVal;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

//,fallback = ProductFallBack.class
@FeignClient(value = "shop-product")
public interface ProductFeignClientService {

    @GetMapping("/sku/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable Long skuId);

    @GetMapping("/sku/getCategoryView/{category3Id}")
    public BaseCategoryView getCategoryView(@PathVariable Long category3Id);

    /*根据产品的id获取sku的销售属性，再根据skuid设置它的默认选中。*/
    @GetMapping("/sku/getSkuSalePropertyKeyAndValue/{productId}/{skuId}")
    public List<ProductSalePropertyKey> getSkuSalePropertyKeyAndValueList(@PathVariable Long productId, @PathVariable Long skuId);

    // 通过spuId 获取对应的Json 字符串。
    @GetMapping("/sku/getSkuSalePropertyValueId/{productId}")
    public Map getSkuSalePropertyValueId(@PathVariable Long productId);

/*==========================================================*/

    // 获取首页分类数据
    @GetMapping("/product/getIndexCategoryInfo")
    public RetVal getIndexCategoryInfo();

    @GetMapping("/product/getSkuInfoById/{skuId}")
    public SkuInfo getSkuInfoById(@PathVariable Long skuId);

    /*根据id 获取品牌*/
    @GetMapping("/product/brand/getBrandById/{id}")
    public BaseBrand getBrandById(@PathVariable Long id);

    @GetMapping("/product/getCategory3ForForeign/{category3Id}")
    public BaseCategoryView getCategory3ForForeign(@PathVariable Long category3Id);

    @PostMapping("/product/getPlatformProperty")
    public List<PlatformPropertyKey> getPlatformProperty(List<SkuPlatformPropertyValue> values);

    @GetMapping("/product/getSkuPriceNow/{skuId}")
    BigDecimal getSkuPriceNow(@PathVariable Long skuId);

}
